//
//  YHBTopView.m
//  HBDemo
//
//  Created by RYX on 2019/3/25.
//  Copyright © 2019 tuobu. All rights reserved.
//

#import "YHBTopView.h"

@interface YHBTopView()

@property (nonatomic,weak) UILabel *la1;
@property (nonatomic,weak) UILabel *la2;
@property (nonatomic,weak) UILabel *la3;
@property (nonatomic,weak) UILabel *la4;

@end

@implementation YHBTopView

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = UIColor.whiteColor;
        [self setUI];
    }
    return self;
}

- (void)setUI{
    
    UILabel *la1 = [[UILabel alloc] init];
    la1.textAlignment = NSTextAlignmentCenter;
    la1.text = @"序号";
    la1.font = [UIFont systemFontOfSize:12];
    [self addSubview:la1];
    self.la1 = la1;
    
    UILabel *la2 = [[UILabel alloc] init];
    la2.textAlignment = NSTextAlignmentLeft;
    la2.text = @"终端编号（SN）";
    la2.font = [UIFont systemFontOfSize:12];
    [self addSubview:la2];
    self.la2 = la2;
    
    UILabel *la3 = [[UILabel alloc] init];
    la3.textAlignment = NSTextAlignmentCenter;
    la3.text = @"状态";
    la3.font = [UIFont systemFontOfSize:12];
    [self addSubview:la3];
    self.la3 = la3;
    
    UILabel *la4 = [[UILabel alloc] init];
    la4.textAlignment = NSTextAlignmentCenter;
    la4.text = @"返现金额";
    la4.font = [UIFont systemFontOfSize:12];
    [self addSubview:la4];
    self.la4 = la4;
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = [UIColor colorWithRed:231/255.0 green:231/255.0 blue:231/255.0 alpha:1.0];
    [self addSubview:line];
    
    [la1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self).offset(26);
        make.width.mas_equalTo(25);
        make.top.bottom.equalTo(self);
    }];
    
    [la4 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self).offset(-15);
        make.width.mas_equalTo(50);
        make.top.bottom.equalTo(self);
    }];
    
    [la3 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(la4.mas_left).offset(-25);
        make.width.mas_equalTo(50);
        make.top.bottom.equalTo(self);
    }];
    
    [la2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(la1.mas_right).offset(31);
        make.right.equalTo(la3.mas_left).offset(-10);
        make.top.bottom.equalTo(self);
    }];
    
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.right.bottom.equalTo(self);
        make.height.mas_equalTo(0.5);
    }];
}
@end
